﻿//jquery.validate.unobstrusive扩展
//notgt
$.validator.addMethod("notgt", function (value, element, params) {
    return parseFloat(value) <= parseFloat($("#" + params["id"]).val());
});
$.validator.unobtrusive.adapters.add("notgt", ["id"], function (options) {
    options.rules["notgt"] = {
        id: options.params.id
    };
    options.messages["notgt"] = options.message;
});
//notlt 
$.validator.addMethod("notlt", function (value, element, params) {    
    return parseFloat(value) >= parseFloat($("#" + params["id"]).val());
});
$.validator.unobtrusive.adapters.add("notlt", ["id"], function (options) {
    options.rules["notlt"] = {
        id: options.params.id
    };    
    options.messages["notlt"] = options.message;
});
//notequal
$.validator.addMethod("notequal", function (value, element, params) {
    return value !== $("#" + params["id"]).val();
});
$.validator.unobtrusive.adapters.add("notequal", ["id"], function (options) {
    options.rules["notequal"] = {
        id: options.params.id
    };
    options.messages["notequal"] = options.message;
});